# Contributor: Olliver Schinagl <oliver@schinagl.nl>
# Maintainer: Olliver Schinagl <oliver@schinagl.nl>
pkgname=nxp-mfgtools
pkgver=1.4.72
pkgrel=2
pkgdesc="Freescale/NXP i.MX Chip image deploy tools"
url="https://github.com/NXPmicro/mfgtools"
arch="all"
license="LGPL-2.1-only"
options="!check" # No tests available
subpackages="$pkgname-uuu lib$pkgname-static lib$pkgname-dev"
makedepends="cmake libusb-dev bzip2-dev libzip-dev openssl1.1-compat-dev"
source="https://github.com/NXPmicro/mfgtools/archive/uuu_$pkgver.tar.gz
	0001-fails-to-build-on-alpine-arm32v6-fix-adding-interpre.patch
	"
builddir="$srcdir/mfgtools-uuu_$pkgver/"

prepare() {
	default_prepare
	echo "$pkgver" > "$builddir/.tarball-version"
}

build() {
	cmake -B build \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

package() {
	depends="$subpackages"

	DESTDIR="$pkgdir" cmake --install build

	install -Dm644 build/libuuu/libuuc_s.a "$pkgdir/usr/lib/libuuc_s.a"
	install -Dm644 libuuu/libuuu.h "$pkgdir/usr/lib/libuuu.h"
}

uuu() {
	amove usr/bin/uuu
}

sha512sums="
c0515c046a68fef0b0776478eea0208a2e595e8d3591c8b967cc3cc8217448989b8f257ef26273f46e1d8cdfa651b16cd2e716a3b23f94d0ca3bfd4509af4fb7  uuu_1.4.72.tar.gz
52293c2ddbb20c3c1b19256f3c6c987b5a43b230ce6da5bae5b6f932d8af27b0cee5b1654cff4b896000bb7f52c78be66ade856f8e95a726e845c0b7d9a6bc6d  0001-fails-to-build-on-alpine-arm32v6-fix-adding-interpre.patch
"
